/**
 * FileName: AppUtils
 * Author: TangZaoBang
 * Date: 2023/04/29 15:26
 * Description:
 * <p>
 * History:
 * <author> TangZaoBang
 * <time> 2023/04/29 15:26
 * <version> 1.0.0
 * <desc> 版本描述
 */

package com.bosssoft.quickstart.demo.utils;

import com.bosssoft.quickstart.demo.pojo.vo.CommonResponse;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * @Class AppUtils
 * @Description
 * @Author TangZaoBang
 * @Date 2023/04/29 15:26
 * @Version
 */
@Component
public class AppUtils {
    private AppUtils() {
        // prevent construct
    }

    @Value("${app.version}")
    private String version;

    private static String myVersion;

    @PostConstruct
    public void init() {
        AppUtils.myVersion = version;
    }

    public static <T> void setResponseExtendInfo(CommonResponse<T> commonResponse) {
        commonResponse.getHead().setVersion(myVersion);
    }
}
